<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>快速入门升级</title>
</head>
<body>
<!--视图-->
<div id="div">
    <div>姓名：{{name}}</div>
    <div>班级：{{classroom}}</div>
    <button onclick="hi()">打招呼</button>
    <button onclick="update()">修改班级</button>
</div>
</body>
<script src="js/vuejs-2.5.16.js"></script>
<script>
    //脚本
    let vm = new Vue({
        el:"#div",
        data:{
            name:"柳岩",
            classroom:"黑马程序员"
        },
        methods:{
            study(){
                alert(this.name+"正在"+this.classroom+"喝酒抽烟");
            }
        }
    });
    //定义打招呼方法
    function hi() {
        vm.study();
    }

    //定义修改班级
    function update() {
        vm.classroom = "山东蓝翔";

    }
</script>
</html>